package com.store.orm.config;

import java.util.Objects;

/**
 * Mongo 配置类
 * host: Mongo的 host
 * port: Mongo的 port
 * db: 将要操作的 MongoDB 的 库
 * pool: 配置连接池参数
 *
 * @author 宫静雨
 * @version 1.0
 */
public class MongoConfig {
    private String host;
    private Integer port;
    private String db;
    private Pool pool;

    public MongoConfig() {
    }

    public MongoConfig(String host, Integer port, Pool pool) {
        this.host = host;
        this.port = port;
        this.pool = pool;
    }

    @Override
    public String toString() {
        return "MongoConfig{" +
                "host='" + host + '\'' +
                ", port=" + port +
                ", db='" + db + '\'' +
                ", pool=" + pool +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MongoConfig that = (MongoConfig) o;
        return Objects.equals(host, that.host) &&
                Objects.equals(port, that.port) &&
                Objects.equals(db, that.db) &&
                Objects.equals(pool, that.pool);
    }

    @Override
    public int hashCode() {
        return Objects.hash(host, port, db, pool);
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getDb() {
        return db;
    }

    public void setDb(String db) {
        this.db = db;
    }

    public Pool getPool() {
        return pool;
    }

    public void setPool(Pool pool) {
        this.pool = pool;
    }
}